import request from '@/utils/request'
import type{ QueryParams, RuleForm } from "@/views/dish/taste/types";
// 查询所有口味
export function listAllTaste() {
  return request({
    url: '/taste/listAll',
    method: 'get'
  })
}

// 查询口味列表
export function listTaste(query: QueryParams) {
  return request({
    url: '/taste',
    method: 'get',
    params: query
  })
}

// 分页查询口味列表
export function listTasteByPage(query: QueryParams) {
  return request({
    url: '/taste/page',
    method: 'get',
    params: query
  })
}

// 根据id查询口味
export function getTasteById(tasteId: number) {
  return request({
    url: '/taste/' + tasteId,
    method: 'get'
  })
}

// 根据tasteName查询口味
export function getTasteByName(tasteName: string) {
  return request({
    url: '/taste/' + tasteName,
    method: 'get'
  })
}

// 新增口味
export function addTaste(data: RuleForm) {
  return request({
    url: '/taste',
    method: 'post',
    data: data
  })
}

// 修改口味
export function updateTaste(data: RuleForm) {
  return request({
    url: '/taste',
    method: 'put',
    data: data
  })
}

// 删除口味
export function deleteTaste(tasteId: number) {
  return request({
    url: '/taste/' + tasteId,
    method: 'delete'
  })
}

// 批量删除口味
export function deleteTasteBatch(tasteIds: number[]) {
  return request({
    url: '/taste/delBatch/' + tasteIds,
    method: 'delete'
  })
}
